package com.example.shiro02.service;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Service;

/**
 * @Version 1.0
 * @Author:zlf
 * @Date:2020/11/23 - 16:25
 * @Content:
 */
@Service
public class UserServiceImpl {
    public void  checkLogin(String userName,String userPwd,boolean rememberMe) throws Exception{
        Subject subject =SecurityUtils.getSubject();
        UsernamePasswordToken token = new UsernamePasswordToken(userName,userPwd);
        token.setRememberMe(rememberMe);//设置rememberMe
        subject.login(token);
    }
}
